<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@page contentType="text/html; charset=UTF-8" import="java.util.*, user.*"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%
	String username = null;
	if (session.getAttribute("uType") != null && session.getAttribute("uType").toString().equals("1")) 
		username = session.getAttribute("username").toString();
	
%>  

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Client Checkout</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<style type="text/css">
	<!--
	.STYLE1 {
		font-size: 16px;
		font-weight: bold;
		font-style: italic;
	}
	.STYLE2 {font-family: "Courier New", Courier, monospace}
	-->
</style>

<script language = "javascript">
	function confirm() {
    	document.form1.action="./DisplayInvoicePage.jsp"; 
		document.form1.submit(); 
	}
</script>
</head>

<body>

<%
	if (username == null) {
		%>
		<script type ="text/javascript">
			alert(unescape('You are not logged in as a customer'))
			window.location.href = './customer_page.jsp'
		</script>
		<% 
	} else {
 		%>
		<form id="form1" name="form1" action = "" >
    	<p align="center">
    	<label>
    	<span class="STYLE4">
    	<a href="index.jsp">
    	<img src="Pics/restaurantLogo.JPG" alt="restaurantLogo" width="242" height="118" border="0" />
    	</a>
    	<br>
    	<br>
    
    	Receiver: <input type="text" name="clientCheckout_receiverName" <%= DisplayCheckoutPage.GetReceiverName(username) %> />
    	<br>Cell No.:
    	</span>
    	<input type="text" name="clientCheckout_cell" <%= DisplayCheckoutPage.GetReceiverCell(username)%>/>      
  		</label>
  		</p>

    	<p align="center">Street
    	<input name="clientCheckout_streetField" type="text" size="70" maxlength="50" <%= DisplayCheckoutPage.GetReceiverAddress(username)%>/>
    	</p>
    	<p align="center">
    	<label>
    	<input type="submit" name="clientCheckout_confirm" value="Check Out" onclick = "confirm()" />
    	<!--  <input type="submit" name="clientCheckout_cancel" value="Cancel"  onclick = "cancel()"/> -->
    	</label>
  		</p>
		</form>
   
    	<div align="center">
    	<form action = "./checkout.jsp" method = "get" id = "form 2" name = 'form 2' />
    	<p>
    	<%
    		String CheckContain = request.getParameter("food_ID");
    		String ContainID = request.getParameter("contain_ID");
     		String ModifiedQuantity = request.getParameter("food_quantity");
    		DisplayCheckoutPage.CancelFood(CheckContain);    	
    	%>
    	<%= DisplayCheckoutPage.UpdateFoodQuantity(ContainID, ModifiedQuantity) %>	   	   	
      
    	<%= DisplayCheckoutPage.GetCheckoutInfo(username) %>
    	</p>
    	</form>
    
  		</div>
  
  		<%
	}
%>

</body>
</html>
